<?php
/**
 * An @annotation in a documentation comment
 */
class Annotation {
    /**
     * The name of this annotation
     * 
     * @var string
     */
    private $name;
    
    /**
     * The value of this annotation
     * 
     * @var string
     */
    private $value;
    
    /**
     * @return string
     */
    public function getName() {
        return $this->name;
    }

    /**
     * @param string $name 
     */
    public function setName($name) {
        $this->name = $name;
    }

    /**
     *
     * @return mixed
     */
    public function getValue() {
        return $this->value;
    }

    /**
     *
     * @param mixed $value 
     */
    public function setValue($value) {
        $this->value = $value;
    }
    
    /**
     * @return string the first word of the value of this annotation 
     */
    public function extractType() {
        $parts = explode(' ', $this->value, 2);
        return $parts[0];
    }
    
    /**
     * @return string all but the first word of the value of this annotation 
     */
    public function extractDescription() {
        $parts = explode(' ', $this->value, 2);
        
        if (count($parts) > 1) {
            return trim($parts[1]);
        }
        else {
            return '';
        }
    }
}
